package com.yl.project.lvyou.booking.service.impl;

import java.util.List;
import com.yl.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yl.project.lvyou.booking.mapper.TicketBookingMapper;
import com.yl.project.lvyou.booking.domain.TicketBooking;
import com.yl.project.lvyou.booking.service.ITicketBookingService;
import com.yl.common.utils.text.Convert;
import com.yl.framework.config.BaseService;

/**
 * 门票预订Service业务层处理
 * 
 * @author yl
 * @date 2025-03-15
 */
@Service
public class TicketBookingServiceImpl extends BaseService<TicketBooking> implements ITicketBookingService 
{
    @Autowired
    private TicketBookingMapper ticketBookingMapper;

    /**
     * 查询门票预订
     * 
     * @param id 门票预订ID
     * @return 门票预订
     */
    @Override
    public TicketBooking selectTicketBookingById(Long id)
    {
        return ticketBookingMapper.selectTicketBookingById(id);
    }

    /**
     * 查询门票预订列表
     * 
     * @param ticketBooking 门票预订
     * @return 门票预订
     */
    @Override
    public List<TicketBooking> selectTicketBookingList(TicketBooking ticketBooking)
    {
        return ticketBookingMapper.selectTicketBookingList(ticketBooking);
    }

    /**
     * 新增门票预订
     * 
     * @param ticketBooking 门票预订
     * @return 结果
     */
    @Override
    public int insertTicketBooking(TicketBooking ticketBooking)
    {
        ticketBooking.setCreateTime(DateUtils.getNowDate());
        return ticketBookingMapper.insertTicketBooking(ticketBooking);
    }

    /**
     * 修改门票预订
     * 
     * @param ticketBooking 门票预订
     * @return 结果
     */
    @Override
    public int updateTicketBooking(TicketBooking ticketBooking)
    {
        ticketBooking.setUpdateTime(DateUtils.getNowDate());
        return ticketBookingMapper.updateTicketBooking(ticketBooking);
    }

    /**
     * 删除门票预订对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTicketBookingByIds(String ids)
    {
        return ticketBookingMapper.deleteTicketBookingByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除门票预订信息
     * 
     * @param id 门票预订ID
     * @return 结果
     */
    @Override
    public int deleteTicketBookingById(Long id)
    {
        return ticketBookingMapper.deleteTicketBookingById(id);
    }

    @Override
    public TicketBooking selectByOrderNo(TicketBooking ticketBooking) {
        return ticketBookingMapper.selectByOrderNo(ticketBooking);
    }

    @Override
    public int updateTicketBookingStatus(TicketBooking ticketBooking) {
        return ticketBookingMapper.updateTicketBookingStatus(ticketBooking);
    }
}
